//
//  SGGraphDataProvider.h
//  SpringGraph Test
//
//  Created by Jack Herrington on 5/30/10.
//  Copyright 2010 Myself. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "FLDataProvider.h"
#import "SGEdgeData.h"

@protocol SGGraphDataDelegate

- (void)moveView:(UIView *)view position:(CGPoint)position;
- (void)refresh;

@property (assign) float repulsionFactor;
@property (assign) float defaultRepulsionFactor;
@property (assign) bool layoutChanged;

@end

@interface SGGraphDataProvider : NSObject <FLDataProvider> {
	id<NSObject,SGGraphDataDelegate> dataDelegate;
	
	NSMutableDictionary *_edgesById;
	NSMutableArray *_edges;

	NSMutableDictionary *_viewsById;
	NSMutableDictionary *_graphNodes;
	NSMutableArray *_nodes;
}

@property (readonly) NSArray *edges;
@property (readonly) NSDictionary *nodes;

- (SGGraphDataProvider *)initWithGraph:(id<NSObject,SGGraphDataDelegate>)dataDelegate;
- (FLNode *)findNode:(UIView *)view;
- (void)add:(UIView *)item;
- (SGEdgeData *)link:(UIView *)item to:(UIView *)to;
- (SGEdgeData *)getLinkData:(UIView	*)item to:(UIView *)to;
- (void)remove:(UIView *)item;
- (void)unlink:(UIView *)item to:(UIView *)to;

@end
